home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / amphibia_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  5.6 KB  |  158 lines

  1.  
  2. function units_amphibia_setup()
  3.     units_setup(4,false,ENET_EFFECT_PS_SETUPSMOKE_SMALL,ENET_EFFECT_GEOMETRY_AMPHIBIASHADOW)
  4. end
  5.  
  6. function units_amphibia_resetup()
  7.     units_setup(4,false,nil,ENET_EFFECT_GEOMETRY_AMPHIBIASHADOW)
  8. end
  9.  
  10. function units_amphibia_select()
  11.     units_select(22,1)
  12. end
  13.  
  14. function units_amphibia_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_amphibia_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_amphibia_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_amphibia_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_amphibia_explode()
  31.     units_explode_small3()
  32. end
  33.  
  34. function units_amphibia_move()
  35.     local unit = uniGetExecutor()
  36.     local sound = unit:play3DSound("amphibia_move.wav",1)
  37.     local steps = {}
  38.     unit:getBone(ENBT_GUNTOWER):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI)
  39.     local eng_smoke2 = unit:addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE4)
  40.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 1.0))
  41.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
  42.     eng_smoke2:suspendedDestroy(5.0)
  43.     sound:destroy()
  44.     unit:play3DSound("amphibia_stop.wav",0):destroy()
  45. end
  46.  
  47. function units_amphibia_fire()
  48.     local unit = uniGetExecutor()
  49.     local gt = unit:getBone(ENBT_GUNTOWER)
  50.     local sound = gt:play3DSound("amphibia_guntower_rotate.wav",1)
  51.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  52.     local gun = gt:getBone(ENBT_GUN)
  53. --    waitDeath(gun:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
  54.     sound:stopSound()
  55.     local firespot = gt:getBone(ENBT_FIRE1)
  56.     local fire = firespot:addSimpleEffect(ENET_EFFECT_PS_FLAMETHROWERFIRE)
  57.     sound = gt:play3DSound("flamethrower_fire.wav",1)
  58.     local shot = firespot:addBulletEffect(ENET_EFFECT_BULLET_FLAMETHROWERFIRE)
  59.     shot:executeCommand(ENC_FIRE1)
  60.     local rot
  61.     rot = gt:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,0.5)
  62.     pause(0.6)
  63.     rot:destroy()
  64.     rot = gt:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,-0.5)
  65.     pause(1.2)
  66.     rot:destroy()
  67.     rot = gt:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,0.5)
  68.     pause(1.2)
  69.     rot:destroy()
  70.     fire:suspendedDestroy(2.5)
  71.     pause(1.0)
  72.     sound:stopSound()
  73.     gt:play3DSound("flamethrower_fire_end.wav",0):destroy()
  74.     unit:addFireArrow()
  75. end
  76.  
  77. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_MOVE,"units_amphibia_move")
  78. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_FIRE1,"units_amphibia_fire")
  79. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_FIRE2,"units_amphibia_fire")
  80. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_SELECT,"units_amphibia_select")
  81. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_SELECTENEMY,"units_amphibia_selectenemy")
  82. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_UNSELECT,"units_amphibia_unselect")
  83. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_SETUP,"units_amphibia_setup")
  84. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_RESETUP,"units_amphibia_resetup")
  85. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_DAMAGED,"units_amphibia_damaged")
  86. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_EXPLODE,"units_amphibia_explode")
  87. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_HIGHLIGHT,"units_amphibia_highlight")
  88. registerCommand(ENSCRIPTSET_AMPHIBIA,ENC_INSIDE,"units_inside")
  89.  
  90. -- make description of unit
  91. desc = getEffectDescriptionP(ENET_UNIT_AMPHIBIA)
  92. desc.ClassID = ENCLASS_MESHINSTANCE
  93. desc.EffectClassType = ENECT_GEOMETRY
  94. desc.FileName = "amphibia.rmd"
  95. desc.ScriptSet = ENSCRIPTSET_AMPHIBIA
  96. desc.MoveType = ENMOVE_AMPHIBIAN
  97. desc.RenderType = ENRENDERTYPE_GEOMETRY
  98. desc.Material = ENMAT_RIGIDSKINNEDMESH
  99. desc.MaterialColors = units_materialcolors_human
  100.  
  101. -- shadow
  102. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_AMPHIBIASHADOW)
  103. desc.ClassID = ENCLASS_MESHINSTANCE
  104. desc.EffectClassType = ENECT_GEOMETRY
  105. desc.FileName = "amphibia_shadow.rmd"
  106. desc.RenderType = ENRENDERTYPE_SHADOW
  107. desc.Material = ENMAT_SHADOW
  108. desc.MaterialColors = units_materialcolors_shadow
  109.  
  110. -- register new unit to logic
  111. unitDesc = logic_getUnitDescP(7)
  112. unitDesc.group = 1
  113. unitDesc.order = 1
  114. unitDesc.unit_res_id = ENET_UNIT_AMPHIBIA
  115. unitDesc.unit_icon_id = "Amphibia_h_small_normal.dds"
  116. unitDesc.active_id = "Amphibia_h_small_active.dds"
  117. unitDesc.pressed_id = "Amphibia_h_small_pressed.dds"
  118. unitDesc.big_icon_id = "Amphibia_h_big_normal.dds"
  119. unitDesc.small_icon_id = "Amphibia_u_stats.dds"
  120. unitDesc.HP = 4
  121. unitDesc.MP = 30
  122. unitDesc.WR = 1
  123. unitDesc.min_WR = 1
  124. unitDesc.WD = 2
  125. unitDesc.WR2 = 0
  126. unitDesc.min_WR2 = 0
  127. unitDesc.WD2 = 0
  128. unitDesc.ability = 2
  129. unitDesc.transport = 0
  130. unitDesc.value = 3
  131. unitDesc.race = 0
  132. unitDesc.fire_pause = 0.75
  133. unitDesc.move_pause = 1.0
  134. unitDesc.unit_info_scale = 0.06
  135. unitDesc.scn_name = "AMPHIBIA"
  136.  
  137. ------------------------------------------------------------------------------------------------------
  138. ------------------------ effects related to unit------------------------------------------------------
  139. ------------------------------------------------------------------------------------------------------
  140.  
  141. function bullets_flamethrower_fire()
  142.     local bullet = uniGetExecutor()
  143.     bullet:setTransformOwner()
  144.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,66,uniGetTarget()),1000)
  145.     local hit_ps = bullet:addSimpleEffect(ENET_EFFECT_PS_FLAMETHROWERFIREHIT)
  146.     pause(2.5)
  147.     local hit_ps2 = bullet:addSimpleEffect(ENET_EFFECT_PS_FLAMETHROWERAFTERFIRE)
  148.     pause(0.5)
  149.     hit_ps:suspendedDestroy(2.0)
  150.     uniGetTarget():executeCommand(ENC_DAMAGED)
  151.     pause(2.5)
  152.     hit_ps2:suspendedDestroy(2.0)
  153.     pause(2.0)
  154.     bullet:destroy()
  155. end
  156.  
  157. registerCommand(ENSCRIPTSET_BULLET_FLAMETHROWERFIRE,ENC_FIRE1,"bullets_flamethrower_fire")
  158.